<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>添加销售记录</title>
		<script type="text/javascript" src="/js/jquery-1.11.1.js"></script>
		<script type="text/javascript" src="/js/bootstrap.js"></script>
		<link rel="stylesheet" type="text/css" href="/css/bootstrap.css"/>
		<link rel="stylesheet" type="text/css" href="/css/style.css"/>
		<style>
			label span{color: #ff0000; padding-right: 5px;}
		</style>
	</head>

	<body>
		<h2>添加销售记录</h2>
		<form id="myForm" class="form-horizontal" method="post" action="/user">
			<div class="form-group">
				<label class="col-sm-1 control-label"><span>*</span>订单编号</label>
				<div class="col-sm-9">
					<input required="required" name="o_id" class="form-control" placeholder="请输入 订单编号"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label"><span>*</span>商品编号</label>
				<div class="col-sm-9">
					<input required="" name="p_id" class="form-control" placeholder="请输入 商品编号"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-1 control-label"><span>*</span>应收额数</label>
				<div class="col-sm-9">
					<input required="" name="o_money" class="form-control" placeholder="请输 应收额数"/>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-1 control-label">备注</label>
				<div class="col-sm-9">
					<input name="o_remarks" class="form-control"/>
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-1 control-label"></label>
				<div class="col-sm-9">
					<button id="btnAdd" type="button" class="btn btn-sm btn-info">提&nbsp;交</button>
					<button type="reset"  class="btn btn-sm btn-warning">重&nbsp;置</button>
				</div>
			</div>

		</form>		
	</body>
</html>
<script>
	$(function () {
		//提交按钮的单击事件
		$("#btnAdd").click(function () {
			$.ajax({
				type: "POST",
				url: "/order/",
				data: $("#myForm").serialize(),
				dataType:"json",
				success: function(vo){
					if(vo.code==200) {
						alert("操作成功！");
						window.location.href = "/pages/order/list.html";
					}else{
						alert("添加失败！"+vo.msg);
					}
				}
			});
		});
	});
</script>